<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title></title>
</head>
<body>
<!--弹窗：经费冻结-->
<div th:fragment="budgetinfoetailfreezsApply" class="modal inmodal fade" id="budgetinfoetailfreezsApply_Modal"
     tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title" id="budgetinfoetailfreezsApply_modalTitle">预算冻结</h4>
                <p id="budgetinfoetailfreezsApply_modalDesc" class="font-bold text-danger"></p>
            </div>
            <div class="modal-body">


                <div class="row">
                    <div class="col-md-12">
                        <div class="table-responsive">
                            <div class="m-l-xs toolbar" id="budgetinfoetailfreezsApply_table_toolbar">
                                <form role="form" id="budgetinfoetailfreezsApply_query_form" class="form-inline">
                                    <div class="form-group m-r-xs">
                                        <label for="budgetinfoetailfreezsApply_title" class="sr-only">单据</label>
                                        <input type="text" class="form-control" id="budgetinfoetailfreezsApply_title"
                                               name="title" placeholder="单据号/标题">
                                    </div>
                                    <div>
                                        <button class="btn btn-primary" type="button"
                                                onclick="budgetinfoetailfreezsApplyObj.refreshTable()">查询
                                        </button>
                                        <button class="btn btn-white" type="button"
                                                onclick="budgetinfoetailfreezsApplyObj.resetTable()">重置
                                        </button>
                                        <button class="btn btn-primary" type="button"
                                                onclick="budgetinfoetailfreezsApplyObj.expertTable()">
                                            <i class="fa fa-download"></i> 导出
                                        </button>
                                    </div>
                                </form>
                            </div>
                            <table id="budgetinfoetailfreezsApply_table" class="table table-striped"></table>
                        </div>
                    </div>
                </div>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>

    <script type="text/javascript">
        $(function () {
            budgetinfoetailfreezsApplyObj.myTable = $('#budgetinfoetailfreezsApply_table').bootstrapTable({
                toolbar: '#budgetinfoetailfreezsApply_table_toolbar',
                exportDataType: "",
                exportTypes: ['excel'],
                method: 'post',
                queryParams: function (param) {
                    param.title = $("#budgetinfoetailfreezsApply_title").val();
                    return param;
                },
                formatNoMatches: function () {  //没有匹配的结果
                    return '暂无数据';
                },
                columns: [{
                    title: '#',
                    align: 'center',
                    width: 50,
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                }, {
                    title: '单据号',
                    field: 'applyCode'
                }, {
                    title: '冻结金额',
                    field: 'money',
                    formatter: function (value, row, index) {
                        return $.moneyFormat(value);
                    }
                }, {
                    title: '标题',
                    field: 'title'
                }, {
                    title: '预算部门',
                    field: 'deptName'
                }, {
                    title: '预算项目',
                    field: 'projectName'
                }, {
                    title: '经济分类',
                    field: 'cateName'
                }],
                responseHandler: function (res) {
                    return res.list;
                }
            });
        })
        var budgetinfoetailfreezsApplyObj = new Object({
            myTable: undefined,
            myModal: $('#budgetinfoetailfreezsApply_Modal'),
            budgetInfoId: undefined,
            init: function (budgetInfoId) {
                $('#budgetinfoetailfreezsApply_query_form')[0].reset();
                this.budgetInfoId = budgetInfoId;
                this.refreshTable();
                this.toggleModal(true)
            },
            refreshTable(){
                let _self = this;
                this.myTable.bootstrapTable('refresh', {
                    url: `/budget/budgetinfodetailfreezs/apply/${_self.budgetInfoId}`,
                })
            },
            resetTable(){
                $('#budgetinfoetailfreezsApply_title').val('');
                this.refreshTable();
            },
            expertTable: function () {
                this.myTable.tableExport({
                    type: 'excel',
                    fileName: '预算冻结导出'
                });
            },
            toggleModal: function (show) {
                this.myModal.modal(show ? 'show' : 'hide');
            },

        })
    </script>
</div>
</body>
</html>